// 定义函数，返回值是number
// let hd:Function;

// 定义函数的结构（参数结构 + 返回值结构）
let hd: (a: number, b: number) => number;

hd = (x: number, y: number): number => {
  return x + y;
};

console.log(hd(4, 9));

type userType = { name: string; age: number };

let addUser: (user: userType) => boolean;
addUser = (u: { name: string; age: number }) => {
  return true;
};
console.log(addUser({ name: "hd", age: 18 }));

// 使用type定义函数，函数参数是userType，返回值boolean
type userAddFun = (user: userType) => boolean;
// 使用type定义好的函数描述具体的addUser2方法
let addUser2: userAddFun = (user: userType): boolean => {
  return true;
};
console.log(addUser2);
